//
//  WeatherMainScrollView.m
//  weather
//
//  Created by 大L君的无敌战舰 on 16/4/12.
//  Copyright © 2016年 bigL.com. All rights reserved.
//

#import "WeatherMainScrollView.h"
#import "WeatherFirstView.h"
#import "BLScrollViewForWeatherSecondView.h"
#import "WeatherThirdScrollView.h"
#import "WeatherFourthView.h"



@interface WeatherMainScrollView ()
/* 第一个View */
@property (strong, nonatomic) WeatherFirstView * firstView;
/* 第二个View */
@property (strong, nonatomic) BLScrollViewForWeatherSecondView * secondView;
/* 第三个View */
@property (strong, nonatomic) WeatherThirdScrollView * thirdScrView;
/* 第四个View */
@property (strong, nonatomic) WeatherFourthView * fourthView;




@end

@implementation WeatherMainScrollView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //加载子控件
        self.contentSize = CGSizeMake(0, BLScreenSize.height * 6);
        [self setChildView];
    }
    return self;
}


-(void)setChildView
{
    /* 第一个View */
    WeatherFirstView * firstView = [[WeatherFirstView alloc]init];
    self.firstView = firstView;
    [self addSubview:firstView];
    //约束
    [firstView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(0);
        make.left.equalTo(self).offset(0);
        make.width.mas_equalTo(BLScreenSize.width);
        make.height.mas_equalTo(BLScreenSize.height - 49);
    }];
    
    /* 第三个View */
    WeatherThirdScrollView * thirdScrView = [[WeatherThirdScrollView alloc]init];
    thirdScrView.contentSize = CGSizeMake(BLScreenSize.width / 9 * 24, 0);
    self.thirdScrView        = thirdScrView;
    //约束
    [self addSubview:thirdScrView];
    [thirdScrView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.firstView.mas_bottom).offset(BLViewSpace);
        make.left.equalTo(self).offset(0);
        make.width.mas_equalTo(BLScreenSize.width);
        make.height.mas_equalTo(BLScreenSize.height * 0.3);
    }];
    
    /* 第二个View */
    BLScrollViewForWeatherSecondView * secondView = [[BLScrollViewForWeatherSecondView alloc]init];
    self.secondView= secondView;
    //约束
    [self addSubview:secondView];
    [secondView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.thirdScrView.mas_bottom).offset(BLViewSpace);
        make.left.equalTo(self).offset(0);
        make.width.mas_equalTo(BLScreenSize.width);
        make.height.mas_equalTo(BLScreenSize.height * 0.6);
    }];
    
    
    /* 第四个View */
    WeatherFourthView * fourthView = [[WeatherFourthView alloc]init];
    self.fourthView = fourthView;
    //约束
    [self addSubview:fourthView];
    [fourthView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.secondView.mas_bottom).offset(BLViewSpace);
        make.left.equalTo(self).offset(0);
        make.width.mas_equalTo(BLScreenSize.width);
        make.height.mas_equalTo(BLScreenSize.height * 0.7);
    }];
    
    
    
    
    
    
    
//    firstView.backgroundColor = BLRandomColor(2);
//    secondView.backgroundColor = BLRandomColor(2);
//    thirdScrView.backgroundColor = BLRandomColor(2);
    fourthView.backgroundColor = BLRandomColor(2);
    
}

@end
